<div [@routerTransition]>
    <div class="m-subheader ">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-xs-6">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>分类管理</span>
                </h3>
                <span class="m-section__sub">
                    分类管理的文本头信息
                </span>
            </div>
            <div class="col-xs-6 text-right" *ngIf="isGranted('Mes58.Pages.Resource.Classification.Caret')">
                <button (click)="createOrEditClassificationModal.show()" class="btn btn-primary blue"><i
                        class="fa fa-plus"></i> 创建新的基类</button>
            </div>
        </div>
    </div>

    <div class="m-content classification-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-treeTable [value]="classifications">

                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 150px;">名称</th>
                                    <th style="width: 150px;">编号</th>
                                    <th style="width: 150px;">类型</th>
                                    <th style="width: 150px;">单位</th>
                                    <th style="width: 150px;" *ngIf="isGranted('Mes58.Pages.Resource.Classification.Caret')">操作</th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-rowNode let-rowData="rowData">
                                <tr>
                                    <td>
                                        <p-treeTableToggler [rowNode]="rowNode" style="color: #5867dd;">
                                        </p-treeTableToggler>
                                        {{rowData.displayName}}
                                    </td>
                                    <td>{{rowData.code}}</td>
                                    <td>{{rowData.typeName}}</td>
                                    <td>{{rowData.unit}}</td>
                                    <td  *ngIf="isGranted('Mes51.Pages.Resource.Classification.Caret')">
                                        <div class="btn-group dropdown" dropdown container="body">
                                            <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                <i class="fa fa-cog"></i><span class="caret"></span>
                                                {{"Actions" | localize}}
                                            </button>
                                            <ul class="dropdown-menu" *dropdownMenu>
                                                <li>
                                                    <a
                                                        (click)="createOrEditClassificationModal.show(undefined, rowData.id)">创建子类</a>
                                                </li>
                                                <li>
                                                    <a
                                                        (click)="createOrEditClassificationModal.show(rowData.id, undefined)">编辑</a>
                                                </li>
                                                <li>
                                                    <a (click)="deleteClassification(rowData.id)">删除</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </ng-template>
                        </p-treeTable>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
    <createOrEditClassificationModal #createOrEditClassificationModal (modalSave)="getClassifications()">
    </createOrEditClassificationModal>
</div>
